home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / BORL_TIP / TI100 / TI317.ASC < prev    next >
Text File  |  1991-09-11  |  4KB  |  199 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.   PRODUCT : TURBO PASCAL TUTOR                         NUMBER : 317
  10.   VERSION : 2.00
  11.        OS : PC-DOS
  12.      DATE : July 17, 1986                                PAGE : 1/3
  13.     TITLE : RECURSION MODIFICATIONS
  14.  
  15.  
  16.  
  17.  
  18.   The following is a list of modifications to be made to the file
  19.   RECUR.EX in version 2.0 of the Turbo Pascal Tutor. The changes
  20.   prevent the program from hanging after deleting the root of the
  21.   binary tree.
  22.  
  23.   NOTE: This code modification updates your version of the Turbo
  24.   Pascal Tutor to version 2.00A.
  25.  
  26.   1. Make a backup copy of the file RECUR.EX.
  27.   2. Load the file RECUR.EX into the Turbo Pascal editor.
  28.   3. In the function LeftNode:
  29.  
  30.   Change from:
  31.           .
  32.           .
  33.           .
  34.         LeftNode := Node^.Parent^.Left = Node;
  35.           .
  36.           .
  37.           .
  38.   Change to:
  39.           .
  40.           .
  41.           .
  42.         LeftNode := (Node^.Parent^.Left = Node) or (Node = nil);
  43.                                                  { Ver. 2.00A }
  44.           .                                      { Modification }
  45.           .
  46.           .
  47.  
  48.   4. In the procedure LeftAndRightNil, change from:
  49.           .
  50.           .
  51.           .
  52.         if LeftNode(Node) then
  53.           Node^.Parent^.Left := Nil
  54.         else
  55.           Node^.Parent^.Right := Nil
  56.           .
  57.           .
  58.           .
  59.  
  60.   Change to:
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.   PRODUCT : TURBO PASCAL TUTOR                         NUMBER : 317
  76.   VERSION : 2.00
  77.        OS : PC-DOS
  78.      DATE : July 17, 1986                                PAGE : 2/3
  79.     TITLE : RECURSION MODIFICATIONS
  80.  
  81.  
  82.  
  83.  
  84.           .
  85.           .
  86.           .
  87.         if Node <> Root then               { Ver. 2.00A Addition }
  88.         begin                              { Ver. 2.00A Addition }
  89.           if LeftNode(Node) then
  90.             Node^.Parent^.Left := Nil
  91.           else
  92.             Node^.Parent^.Right := Nil
  93.         end;                               { Ver. 2.00A Addition }
  94.           .
  95.           .
  96.           .
  97.  
  98.   5. In the procedure LeftNil, change from:
  99.           .
  100.           .
  101.           .
  102.         if LeftNode(Node) then
  103.           Node^.Parent^.Left := Node^.Right
  104.         else
  105.           Node^.Parent^.Right := Node^.Right;
  106.           .
  107.           .
  108.           .
  109.   Change to:
  110.           .
  111.           .
  112.           .
  113.         if Node <> Root then            { Ver. 2.00A Addition }
  114.         begin                           { Ver. 2.00A Addition }
  115.           if LeftNode(Node) then
  116.             Node^.Parent^.Left := Node^.Right
  117.           else
  118.             Node^.Parent^.Right := Node^.Right;
  119.         end;                            { Ver. 2.00A Addition }
  120.           .
  121.           .
  122.           .
  123.  
  124.   6. In the procedure RightNil, change from:
  125.           .
  126.           .
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.   PRODUCT : TURBO PASCAL TUTOR                         NUMBER : 317
  142.   VERSION : 2.00
  143.        OS : PC-DOS
  144.      DATE : July 17, 1986                                PAGE : 3/3
  145.     TITLE : RECURSION MODIFICATIONS
  146.  
  147.  
  148.  
  149.  
  150.           .
  151.         if LeftNode(Node) then
  152.           Node^.Parent^.Left := Node^.Left
  153.         else
  154.           Node^.Parent^.Right := Node^.Left;
  155.           .
  156.           .
  157.           .
  158.   Change to:
  159.           .
  160.           .
  161.           .
  162.         if Node <> Root then            { Ver. 2.00A Addition }
  163.         begin                           { Ver. 2.00A Addition }
  164.           if LeftNode(Node) then
  165.             Node^.Parent^.Left := Node^.Left
  166.           else
  167.             Node^.Parent^.Right := Node^.Left;
  168.         end;                             { Ver. 2.00A Addition }
  169.           .
  170.           .
  171.           .
  172.  
  173.   7. Save the file.
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.